fix(webserver): remove duplicate Date headers in responses#65086
fix(webserver): remove duplicate Date headers in responses#65086tysoncung wants to merge 1 commit intoapache:mainfrom
Conversation
) - Add ResponseHeaderDedupMiddleware to remove duplicate response headers - Fixes issue where both uvicorn and Flask add Date headers - Middleware keeps only the first occurrence of each header (case-insensitive) - Applied before HttpAccessLogMiddleware to ensure clean responses Closes apache#64678
pierrejeambrun
left a comment
There was a problem hiding this comment.
Instead of adding a middleware that will strip out the duplicated headers. Can we instead fix the ASGI app (flask) to not include that unwanted Date header ?
|
@tysoncung Converting to draft — this PR doesn't yet meet our Pull Request quality criteria.
See the linked criteria for how to fix each item, then mark the PR "Ready for review". This is not a rejection — just an invitation to bring the PR up to standard. No rush. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
|
@tysoncung This draft PR has been inactive for 13 days since the last triage comment and no response from the author. Closing to keep the queue clean. You are welcome to reopen this PR when you resume work, or to open a new one addressing the issues previously raised. There is no rush — take your time. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. |
Problem
HTTP responses from the Airflow webserver contain duplicate
Dateheaders. This occurs because both uvicorn (the ASGI server) and Flask (mounted via WSGIMiddleware) each add their ownDateheader, violating HTTP specifications which require headers to be unique.Example:
Closes #64678
Solution
Added
ResponseHeaderDedupMiddlewarethat:HttpAccessLogMiddlewareto ensure clean responses are loggedFiles Changed
airflow-core/src/airflow/api_fastapi/core_api/app.py- Added middleware registrationairflow-core/src/airflow/api_fastapi/common/response_header_dedup.py- New middleware implementationTesting
This middleware ensures all responses have unique headers, regardless of whether they come from FastAPI routes or Flask routes mounted via WSGIMiddleware.